package com.lonwin.inspectionmanagement.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lonwin.inspectionmanagement.R;
import com.lonwin.inspectionmanagement.app.utils.TimeUtils;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.NoSortOutBean;
import com.lonwin.inspectionmanagement.mvp.ui.activity.CreatPointRecordActivity;

import java.util.List;

public class NoSortOutRecordItem1Adapter extends BaseQuickAdapter<NoSortOutBean.DataBean.RecordsBean.QuestTempDtosBean,BaseViewHolder> {
    public NoSortOutRecordItem1Adapter(@Nullable List<NoSortOutBean.DataBean.RecordsBean.QuestTempDtosBean> data) {
        super(R.layout.nosortout_record_item_item1,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NoSortOutBean.DataBean.RecordsBean.QuestTempDtosBean item) {
        String title=((item.getQusetTypeTempRel()!=null&&item.getQusetTypeTempRel().size()>0)?item.getQusetTypeTempRel().get(0).getQuestTypenm():"")+"("+item.getAddr()+")";
        helper.setText(R.id.nosortout_record_item_item1_type,title)
                .setText(R.id.nosortout_record_item_item1_time,TimeUtils.dateForStr(item.getSystm()));
        helper.<TextView>getView(R.id.nosortout_record_item_item_edit).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CreatPointRecordActivity.startCreatPointActivity(mContext,item.getQuestid(), CreatPointRecordActivity.Type.EDIT,"编辑问题记录");
            }
        });
    }
}
